# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>

pkgname=libindi
pkgver=2.0.4
pkgrel=2
pkgdesc='A distributed control protocol designed to operate astronomical instrumentation'
url='https://www.indilib.org/index.php?title=Main_Page'
license=(GPL2)
arch=(loong64 x86_64)
depends=(libnova cfitsio libjpeg gsl libtheora fftw libev rtl-sdr)
makedepends=(cmake qt5-base)
source=(https://github.com/indilib/indi/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('56b839c2f863f8c1b6b0b802abf64f086269c128f3a02b00f3d35f1567fb9bb6')

build() {
  cmake -B build -S indi-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DINDI_BUILD_QT5_CLIENT=ON \
    -DUDEVRULES_INSTALL_DIR=/usr/lib/udev/rules.d \
    -DCMAKE_C_FLAGS="$CFLAGS -ffat-lto-objects" \
    -DCMAKE_CXX_FLAGS="$CXXFLAGS -ffat-lto-objects -Wp,-U_GLIBCXX_ASSERTIONS"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
